package com.ruoyi.common.utils;/*
 *
 * 2021-12-29 17:30
 */

public class ASC {
    private static int ascNum;
    private static char strChar;

    public static void main(String[] args) {
        //0201060708444757543332 11ff 003d 0000 56 5a4d323230313031323139
        String advData ="020106070844475754333211ff003d0000565a4d323230313031323139";
        String i = advData.substring(36,38);
        String i1 = advData.substring(38,40);
        String i2 = advData.substring(40,42);
        String i3 = advData.substring(42,44);
        String i4 = advData.substring(44,46);
        String i5 = advData.substring(46,48);
        String i6 = advData.substring(48,50);
        String i7 = advData.substring(50,52);
        String i8 = advData.substring(52,54);
        String i9 = advData.substring(54,56);
        String i10 = advData.substring(56,58);
        int d = Integer.parseInt(i,16);
        int d1 = Integer.parseInt(i1,16);
        int d2 = Integer.parseInt(i2,16);
        int d3 = Integer.parseInt(i3,16);
        int d4 = Integer.parseInt(i4,16);
        int d5 = Integer.parseInt(i5,16);
        int d6 = Integer.parseInt(i6,16);
        int d7 = Integer.parseInt(i7,16);
        int d8 = Integer.parseInt(i8,16);
        int d9 = Integer.parseInt(i9,16);
        int d10 = Integer.parseInt(i10,16);
        /*String i11 = advData.substring(58,60);*/
        System.out.println(i+i1+i2+i3+i4+i5+i6+i7+i8+i9+i10);
        String id = String.valueOf(ASC.backchar(d));
        String id1 = String.valueOf(ASC.backchar(d1));
        String id2 = String.valueOf(ASC.backchar(d2));
        String id3 = String.valueOf(ASC.backchar(d3));
        String id4 = String.valueOf(ASC.backchar(d4));
        String id5 = String.valueOf(ASC.backchar(d5));
        String id6 = String.valueOf(ASC.backchar(d6));
        String id7 = String.valueOf(ASC.backchar(d7));
        String id8 = String.valueOf(ASC.backchar(d8));
        String id9 = String.valueOf(ASC.backchar(d9));
        String id10 = String.valueOf(ASC.backchar(d10));
        String ID = id+id1+id2 + id3 + id4 + id5 + id6 + id7 + id8+id9 + id10;
        System.out.println(ID);

        System.out.println(getAsc("a"));
        System.out.println(backchar(98));
    }

    /**
     * 字符转ASC
     *
     * @param st
     * @return
     */
    public static int getAsc(String st) {
        byte[] gc = st.getBytes();
        ascNum = (int) gc[0];
        return ascNum;
    }

    /**
     * ASC转字符
     *
     * @param backnum
     * @return
     */
    public static char backchar(int backnum) {
        strChar = (char) backnum;
        return strChar;
    }
}
